package com.tjec.project.mdmSynchronous;

import com.tjec.project.businessStandardLibrary.service.IBmsKnowledgeTemplateService;
import com.tjec.project.mdmSynchronous.mapper.BmsProjectLeaderMapper;
import com.tjec.project.mdmSynchronous.service.IBmsProjectLeaderService;
import com.tjec.project.mdmSynchronous.service.ISysAdministrativeService;
import com.tjec.project.projectLeaderWorkbeanch.service.IBmsLeaderMemberService;
import com.tjec.project.projectWorkbench.service.IBmsProjectContractService;
import com.tjec.project.projectWorkbench.service.IBmsProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Calendar;
import java.util.Date;

/**
 * @Author: VillWang
 * @Date: 2020/5/13 13:41
 */
@Component
@PropertySource("classpath:/quartz.properties")
public class MdmSchedule {

    @Autowired
    private ISysAdministrativeService iSysAdministrativeService;
    @Autowired
    private IBmsProjectContractService bmsProjectContractService;
    @Autowired
    private IBmsProjectLeaderService bmsProjectLeaderService;
    @Autowired
    private IBmsProjectService bmsProjectService;
    @Autowired
    private BmsProjectLeaderMapper bmsProjectLeaderMapper;


    /**
     * 每天的0点半执行
     */
//	 生产服务器EC1定时任务:
//	 @Scheduled(cron = "0 30 1 * * ?")
//	 生产服务器EC2定时任务:
//	 @Scheduled(cron = "0 30 0 * * ?")
    @Scheduled(cron="${projectLeader.synchronous.timer}")
    public void administrativeQuartz(){
        long maxLeader =bmsProjectLeaderMapper.selectMaxTime();
        //同步项目负责人
        bmsProjectLeaderService.synchronous(maxLeader);
        //获取项目的最大时间戳
        //long max = bmsProjectService.selectMaxTime();
        //更新项目
        //bmsProjectService.synchronous(null,null,max);
        //更新项目合同
        long maxProjectContract =bmsProjectContractService.selectMaxTime();
        bmsProjectContractService.synchronous(null,maxProjectContract);

    }
}
